# Maintainer: George Rawlinson <grawlinson@archlinux.org>

pkgname=cl-trivial-backtrace
_pkgname="${pkgname#cl-}"
pkgver=1.1.0.r20.g6eb65bd
pkgrel=1
pkgdesc='Portable API to work with backtraces in Common Lisp'
arch=('any')
url='https://github.com/gwkkwg/trivial-backtrace'
license=('MIT')
depends=('common-lisp' 'cl-asdf')
makedepends=('git')
checkdepends=('sbcl' 'cl-lift')
_commit='6eb65bde7229413040c81d42ea22f0e4c9c8cfc9'
source=(
  "$pkgname::git+$url#commit=$_commit"
  'run-tests.lisp'
)
b2sums=('SKIP'
        'c74cd6f9e7da7e0b1a89076de170f44c28b4746fca0a2bbd6489f5cd01ea8fb12a8636a3a212b71a132cc5a7856e119a1cd7679790f3d0fc341a9657cb6453c3')

pkgver() {
  cd "$pkgname"

  # first known commit to receive latest version
  local _pkgcommit='3d39b1101e6fc59ef57c0ef049f3411d6da3e878'
  local _pkgver=1.1.0 
  git tag "$_pkgver" "$_pkgcommit"

  git describe --tags | sed -e 's/^v//' -e 's/-/.r/' -e 's/-/./g'
}

check() {
  cd "$pkgname"

  sbcl --script ../run-tests.lisp
}

package() {
  cd "$pkgname"

  # library
  install -vd "$pkgdir/usr/share/common-lisp/source/$_pkgname"
  cp -vr \
    dev test \
    lift-standard.config ./*.asd \
    "$pkgdir/usr/share/common-lisp/source/$_pkgname"

  # license
  install -vDm644 -t "$pkgdir/usr/share/licenses/$pkgname" COPYING
}
